// 封装spu模块数据接口
import request from '@/utils/request'
import type {ResponseSaleAttrListData,SPUItem, ResponseSPUData,ResponseBrandData , ResponseSPUInfoData,} from '@/types/product/spu'

// 获取spu列表数据接口
export const getSpuListAPI = (page: number, limit: number,CategoryId: number | string) => {
    return request.get<any,ResponseSPUData>(`/admin/product/${page}/${limit}?Category3Id=${CategoryId}`)
}

// 获取spu详情数据接口
export const getSpuDetailAPI = (spuId: number | string) => {
    return request.get<any,ResponseSPUInfoData>(`/admin/product/getSpuInfo/${spuId}`)
}

// 获取所有品牌列表数据接口
export const getTrademarkListAPI = () => {
    return request.get<any,ResponseBrandData>(`/admin/product/baseTrademark/getTrademarkList`)
}

// 获取所有销售列表属性
export const getScaleAttrListAPI = () => {
    return request.get<any,ResponseSaleAttrListData>(`/admin/product/baseSaleAttrList`)
}


// 添加spu数据接口
export const addSpuAPI = (data: SPUItem) => {
    return request.post<any,any>(`/admin/product/saveSpuInfo`,data)
}

// 更新spu数据接口
export const updateSpuAPI = (data: SPUItem) => {
    return request.post<any,any>(`/admin/product/updateSpuInfo`,data)
}

// 删除spu数据接口
export const deleteSpuAPI = (spuId: number | string) => {
    return request.delete<any,any>(`/admin/product/deleteSpu/${spuId}`)
}